import axios from '@/utils/request.js'
// 员工列表
export function sysUser(params) {
  return axios({
    url: '/sys/user',
    params
  })
}
// 新增员工
export function sysUserPost(data) {
  return axios({
    url: '/sys/user',
    method: 'post',
    data
  })
}
// 删除员工
export function sysUserDelete(id) {
  return axios({
    url: '/sys/user/' + id,
    method: 'delete'
  })
}
// 批量导入员工
export function sysUserBatch(data) {
  return axios({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
// 修改员工基本信息，包括头像
export function sysUserPut(data) {
  return axios({
    url: '/sys/user/' + data.id,
    method: 'put',
    data
  })
}
// 获取员工个人详情
export function employeesPersonalInfo(id) {
  return axios({
    url: `/employees/${id}/personalInfo`
  })
}
// 更新员工个人详情
export function employeesPersonalInfoPut(data) {
  return axios({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'put',
    data
  })
}

// 获取员工岗位详情
export function employeesJobs(id) {
  return axios({
    url: `/employees/${id}/jobs`
  })
}
// 更新员工岗位详情
export function employeesJobsPut(data) {
  return axios({
    url: `/employees/${data.userId}/jobs`,
    method: 'put',
    data
  })
}
// 给员工分配角色
export function sysUserAssignRoles(id, roleIds) {
  return axios({
    url: '/sys/user/assignRoles',
    method: 'put',
    data: {
      id,
      roleIds
    }
  })
}
